package com.imedway.ihe.dtz.xds.dao.camel;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;

import com.imedway.ihe.dtz.xds.entity.camel.XdsDocumentEntryPO;
import com.imedway.ihe.dtz.xds.entity.camel.XdsFolderPO;

import lombok.extern.slf4j.Slf4j;

/**
 * @author dtz <br/>
 * @date 2024/7/4
 */
@Slf4j
@Repository
public class UpdateBaseDao_CAMEL {
	
	@Resource
	private JdbcTemplate jdbcTemplate;
		
	@Resource
	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
	
    public void updateXdsDocumentEntryPO(XdsDocumentEntryPO po)  {	
    	StringBuilder sql = new StringBuilder();
		sql.append(" UPDATE camel_xdsdocumententry  set availabilityStatus=:availabilityStatus ");
		sql.append(" where 1=1  and entryUuid=:entryUuid");
	    Map<String, Object> parameters = new HashMap<>();
	    parameters.put("availabilityStatus", po.getAvailabilityStatus());
	    parameters.put("entryUuid", po.getEntryUuid());
		log.info(sql.toString());
	    namedParameterJdbcTemplate.update(sql.toString(), parameters);	    
    }
    public void updateXdsFolderPO(XdsFolderPO po)  {	
    	StringBuilder sql = new StringBuilder();
		sql.append(" UPDATE camel_xdsfolder  set lastUpdateTime=:lastUpdateTime ");
		sql.append(" where 1=1  and entryUuid=:entryUuid");
	    Map<String, Object> parameters = new HashMap<>();
	    parameters.put("lastUpdateTime", po.getLastUpdateTime());
	    parameters.put("entryUuid", po.getEntryUuid());
		log.info(sql.toString());
	    namedParameterJdbcTemplate.update(sql.toString(), parameters);	    
    }
}
